-
Java v21 .
-
Forced you into OOP by requiring declarations inside classes, but in v21 you no longer need a class to create functions.
-
New syntax:
void main() {
System.out.println('hi mom');
}
-
Uses JDK (Java Development Kit) for X.
-
Default access control: Package-Private.
-
A class, property, or method without an explicit access modifier will have restricted visibility to the package where it was declared.
-
Syntax
-
The default access modifier for members (properties, methods, and classes) is package-private , and not
private. This means:-
If you do not specify a visibility modifier in Java :
-
The member will only be accessible within the same package .
-
It will not be accessible outside the package , even if it is in the same class hierarchy.
-
-
Java default visibility (package-private):
-
A class, property, or method without an explicit access modifier will have visibility restricted to the package where it was declared.
-
-
-
It is quite "verbose".
-
A simple print is a huge sequence of boilerplate.
class HelloWorld {
public static void main(String[] args) {
String hello_mom = 'hello mom';
System.out.println(hello_mom);
}
}